package com.ww.sound_emission.controller;


import com.ww.sound_emission.domain.PersonalInformation;
import com.ww.sound_emission.service.PersonalInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/personal-information")
@CrossOrigin
public class PersonalInformationController {

    @Autowired
    private PersonalInformationService personalInformationService;

    /**
     * 接收前端提交的个人信息
     *
     * @param personalInformation 前端提交的表单数据
     * @return 操作结果
     */
    @PostMapping("/submit")
    @CrossOrigin
    public String submitPersonalInformation(@RequestBody PersonalInformation personalInformation) {
        // 调用 Service 层保存数据
        personalInformationService.save(personalInformation);
        return "个人信息提交成功！";
    }
}